<?php
namespace app\index\controller;

use think\Controller;
use app\index\controller\MysqlPdo;
class Book extends Controller
{
     //渲染魔板
    public function book()
    {
            return $this->fetch('book');
    }
    //添加
    public function add()
    {
          $arr=$_POST;

          $res=new MysqlPdo();

          $data=$res->add($arr);

          if($data){
               $this->success('新增成功', 'Book/list');
          }else{
              $this->error('新增失败');
          }
    }
    //展示
    public function list($page,$name)
    {
        $page=$_GET['page']??1;

        print_r($page);die;
        $name=$_GET['name']??'';
        $res=new MysqlPdo();

        $data=$res->list($page,$name);

        return $this->fetch('list',['data'=>$data,'page'=>$page,'name'=>$name]);
    }
    //删除
    public function del($id)
    {
          $id=$_GET;

        $res=new MysqlPdo();

        $data=$res->del($id);

        print_r($data);die;


    }
    public function show()
    {
         $page=requet()->get('page',1);
         $limit=requet()->limit('limit',6);


    }
}